package com.study.designpatterns;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * @author dfj
 * Date:2018/11/10
 * 装饰模式  自定义将大写字母转为小写字母
 */
public class LowerCaseInputStream extends FilterInputStream{

    public LowerCaseInputStream(InputStream in) {
        super(in);
    }

    @Override
    public int read() throws IOException {
        int c =super.read();
        return c==-1?c:Character.toLowerCase((char)c);
    }

    @Override
    public int read(byte[] b) throws IOException {
        return super.read(b);
    }
}
